<script setup>
import { useRouter } from 'vue-router';
import { ArrowLeft, HomeFilled } from '@element-plus/icons-vue';
import notFoundImage from '@/assets/404.png'; // 使用 ES 模块导入图片


const router = useRouter();

const goBack = () => {
  router.go(-1);
};

const goHome = () => {
  router.push('/');
};
</script>

<template>
<div class="not-found">
    <el-card class="box-card">
    <template #header>
        <div class="card-header">
        <span>404 - 页面未找到</span>
        </div>
    </template>
    <div class="text item">
        <el-image :src="notFoundImage" fit="contain" style="width: 100%; max-height: 300px;"></el-image>
        <p>您访问的页面不存在。</p>
        <el-button type="primary" @click="goBack">
        <el-icon><ArrowLeft /></el-icon>
        返回上一页
        </el-button>
        <el-button type="success" @click="goHome">
        <el-icon><HomeFilled /></el-icon>
        返回首页
        </el-button>
    </div>
    </el-card>
</div>
</template>

<style scoped>
.not-found {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f2f5;
}

.box-card {
    width: 400px;
    text-align: center;
}

.card-header {
    font-size: 24px;
    color: #333;
}

.text {
    font-size: 16px;
    color: #666;
}

.item {
    margin-bottom: 18px;
}

</style>